home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The 640 MEG Shareware Studio 2
/
The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO
/
clang
/
nn.zip
/
MATCH.C
< prev
next >
Wrap
C/C++ Source or Header
|
1989-06-28
|
2KB
|
73 lines
#define NUL '\0'
#define NULL ((char *)0)
#ifdef notdef
/* use this table for creating input to the match.h routines */
char match_xxx[128] = {
/* NUL SOH STX ETX EOT ENQ ACK BEL BS TAB NL VT FF CR SO SI */
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
/* DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US */
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
/* SP ! " # $ % & ' ( ) * + , - . / */
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
/* 0 1 2 3 4 5 6 7 8 9 : ; < = > ? */
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
/* @ A B C D E F G H I J K L M N O */
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
/* P Q R S T U V W X Y Z [ \ ] ^ _ */
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
/* ` a b c d e f g h i j k l m n o */
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00,
/* p q r s t u v w x y z { | } ~ DEL */
00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00
};
#endif
/*
* the following routines only works for ASCII !!!!
*
* they are a quick hack to check for the occurrence of a word
* (regardless of case) in a string
*/
#define UNIFY 040
init_quick_match(mask)
char *mask;
{
register char *m;
for (m = mask; *m; m++) *m |= UNIFY;
}
char *quick_match(subject, mask)
register char *subject;
char *mask;
{
register char *q, *m;
register char m1 = *mask;
for (; *subject; subject++) {
if ((*subject | UNIFY) != m1) continue;
q = subject; m = mask;
do
if (*++m == NUL) return subject;
while ((*++q | UNIFY) == *m);
}
return NULL;
}